/**
 * @Author 韦建韩
 * @Date 2022/5/20
 */
package com.example.devops.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.devops.dao.MirrorCreateMapper;
import com.example.devops.dao.ProjectMapper;
import com.example.devops.entity.common.Result;
import com.example.devops.entity.pojo.MirrorInformation;
import com.example.devops.entity.pojo.Project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IpToAddrService {
    @Autowired
    ProjectMapper projectMapper;
    @Autowired
    MirrorCreateMapper mirrorCreateMapper;

    public Result IpToAddr(String url) {
        QueryWrapper q = new QueryWrapper();
        q.eq("url_addr", url);
        Project project = projectMapper.selectOne(q);
        Long mirrorId = project.getMirrorId();
        MirrorInformation mirrorInformation = mirrorCreateMapper.selectById(mirrorId);
        return Result.doCreate(mirrorInformation);

    }
}
